﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Text;
using T.FAS.Runtime.Term.Entity;
using T.ServiceComponent.DAC.Service;

namespace T.FAS.Runtime.Term.Dao
{
    public class I18nLanguageDao : DaoService<I18nLanguage>
    {
        public I18nLanguageDao() :
           base()
        {
            DBName = "TMaster";
        }

        public override string TableName => "I18n_language";
        public override I18nLanguage ConvertToObject(Dictionary<string, PropertyInfo> columns, DataRow row)
        {
            var myCol = new Dictionary<string, PropertyInfo>(base.Columns);
            var data = base.ConvertToObject(myCol, row);
            return data;
        }
        /// <summary>
        /// 语言列表
        /// </summary>
        /// <returns></returns>
        public List<I18nLanguage> GetI18nLanguages()
        {
            var result = new List<I18nLanguage>();
            List<object> objects = base.GetObjectsByFilter("IsShow=1");
            if (objects != null)
            {
                objects.ForEach(obj => result.Add(obj as I18nLanguage));
            }
            return result;
        }
    }
}
